package weather;

import weather.classes.Clear;
import weather.classes.Cloudy;
import weather.classes.Weather;

public class Main {
    public static void main(String[] args) {

        Clear clear1 = new Clear();
        Clear clear2 = new Clear(25);

        Cloudy cloudy1 = new Cloudy();
        Cloudy cloudy2 = new Cloudy(15);

        Weather[] weatherArray = new Weather[4];
        weatherArray[0] = clear1;
        weatherArray[1] = clear2;
        weatherArray[2] = cloudy1;
        weatherArray[3] = cloudy2;

        for (int i = 0; i < weatherArray.length; i++) {
            System.out.println("\n№" + i + " (До изменений)");
            weatherArray[i].displayInfo();
            System.out.println("\n№" + i + " (Выполняем изменения)");

            // Приведение типа
            if (weatherArray[i] instanceof Clear) {
                Clear clr = (Clear)weatherArray[i];
                clr.changeUV();
                //((Clear)weatherArray[i]).changeUV();
            }
            else if (weatherArray[i] instanceof Cloudy) {
                Cloudy cld = (Cloudy)weatherArray[i];
                cld.changeCloudCover();
            }

            System.out.println("\n№" + i + " (После изменений)");
            weatherArray[i].displayInfo();
        }
    }
}